package com.miao.im.server;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelOutboundHandlerAdapter;
import io.netty.channel.ChannelPromise;
import io.netty.handler.codec.http.websocketx.BinaryWebSocketFrame;
import lombok.extern.slf4j.Slf4j;

/**
 * @Auther: miaoguoxin
 * @Date: 2021/5/17 14:12
 * @Description:
 */
@Slf4j
public class WebsocketOutBoundHandler extends ChannelOutboundHandlerAdapter {
    @Override
    public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {
        super.write(ctx, msg, promise);
        if (msg instanceof BinaryWebSocketFrame){
            BinaryWebSocketFrame binaryMsg = (BinaryWebSocketFrame)msg;
            int i = binaryMsg.content().readInt();
        }
        log.info("写出类型:{}",msg.getClass().getName());
    }
}
